package Interfaz;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;


/**
 * CU022 - Listar todas las competencias deportivas
 * @author 
 */
public class CU022 {

	protected Shell shlCompetencias;
	private Text text;
	private Text text_1;
	private Table table;

	/**
	 * Launch the application.
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			CU022 window = new CU022();
			window.open();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Open the window.
	 */
	public void open() {
		Display display = Display.getDefault();
		createContents();
		
		// Centrar ventana
		Monitor primary = display.getPrimaryMonitor();
		Rectangle bounds = primary.getBounds();
		Rectangle rect = shlCompetencias.getBounds();	    
		int x = bounds.x + (bounds.width - rect.width) / 2;
		int y = bounds.y + (bounds.height - rect.height) / 2;	    
		shlCompetencias.setLocation(x, y);
		
		Label label = new Label(shlCompetencias, SWT.NONE);
		label.setText("Filtros:");
		label.setBounds(10, 15, 55, 15);
		
		Button button = new Button(shlCompetencias, SWT.CHECK);
		button.setText("Nombre de competencia:");
		button.setBounds(10, 45, 150, 16);
		
		text = new Text(shlCompetencias, SWT.BORDER);
		text.setBounds(166, 43, 219, 21);
		
		Button button_1 = new Button(shlCompetencias, SWT.CHECK);
		button_1.setText("Deporte:");
		button_1.setBounds(10, 85, 60, 16);
		
		Combo combo = new Combo(shlCompetencias, SWT.READ_ONLY);
		combo.setItems(new String[] {"B\u00E1squetbol", "F\u00FAtbol", "Handbol", "Tenis"});
		combo.setBounds(76, 83, 128, 23);
		
		Button button_2 = new Button(shlCompetencias, SWT.CHECK);
		button_2.setText("Modalidad:");
		button_2.setBounds(10, 125, 75, 16);
		
		Combo combo_1 = new Combo(shlCompetencias, SWT.READ_ONLY);
		combo_1.setItems(new String[] {"Eliminatoria Doble", "Eliminatoria Simple", "Liga"});
		combo_1.setBounds(91, 123, 136, 23);
		
		Button button_3 = new Button(shlCompetencias, SWT.CHECK);
		button_3.setText("Estado:");
		button_3.setBounds(10, 165, 55, 16);
		
		Combo combo_2 = new Combo(shlCompetencias, SWT.READ_ONLY);
		combo_2.setItems(new String[] {"Creada", "Planificada", "En disputa", "Finalizada"});
		combo_2.setBounds(71, 163, 128, 23);
		
		Button btnNombreDelCreador = new Button(shlCompetencias, SWT.CHECK);
		btnNombreDelCreador.setBounds(10, 205, 124, 16);
		btnNombreDelCreador.setText("Nombre del creador:");
		
		text_1 = new Text(shlCompetencias, SWT.BORDER);
		text_1.setBounds(140, 200, 219, 21);
		
		Button button_4 = new Button(shlCompetencias, SWT.NONE);
		button_4.setText("Buscar");
		button_4.setBounds(10, 247, 108, 32);
		
		Label label_1 = new Label(shlCompetencias, SWT.NONE);
		label_1.setText("Resultados de la b\u00FAsqueda:");
		label_1.setBounds(10, 297, 150, 15);
		
		table = new Table(shlCompetencias, SWT.BORDER | SWT.FULL_SELECTION);
		table.setLinesVisible(true);
		table.setHeaderVisible(true);
		table.setBounds(10, 327, 774, 154);
		
		TableColumn tableColumn = new TableColumn(table, SWT.NONE);
		tableColumn.setWidth(170);
		tableColumn.setText("Nombre competencia");
		
		TableColumn tableColumn_1 = new TableColumn(table, SWT.NONE);
		tableColumn_1.setWidth(150);
		tableColumn_1.setText("Deporte");
		
		TableColumn tableColumn_2 = new TableColumn(table, SWT.NONE);
		tableColumn_2.setWidth(150);
		tableColumn_2.setText("Modalidad");
		
		TableColumn tableColumn_3 = new TableColumn(table, SWT.NONE);
		tableColumn_3.setWidth(150);
		tableColumn_3.setText("Estado");
		
		TableColumn tblclmnCreador = new TableColumn(table, SWT.NONE);
		tblclmnCreador.setWidth(150);
		tblclmnCreador.setText("Creador");
		
		TableItem tableItem = new TableItem(table, 0);
		tableItem.setText(new String[] {"Torneo 1", "Handbol", "Liga", "Creada", "Usuario A"});
		
		TableItem tableItem_1 = new TableItem(table, 0);
		tableItem_1.setText(new String[] {"Torneo 2", "F\u00FAtbol", "Eliminatorias Doble", "Planificada", "Usuario B"});
		
		TableItem tableItem_2 = new TableItem(table, 0);
		tableItem_2.setText(new String[] {"Torneo 3", "Tenis", "Eliminatorias Simple", "Finalizada", "Usuario C"});
		
		TableItem tableItem_3 = new TableItem(table, SWT.NONE);
		tableItem_3.setText(new String[] {"Torneo 4", "Voley", "Eliminatoria Simple", "En disputa", "Usuario D"});
		
		Button btnSalir = new Button(shlCompetencias, SWT.NONE);
		btnSalir.setText("Salir");
		btnSalir.setBounds(663, 518, 108, 32);
		
		Button btnVerTablaDe = new Button(shlCompetencias, SWT.CENTER);
		btnVerTablaDe.setText("Ver ranking");
		btnVerTablaDe.setBounds(528, 518, 108, 32);
		
		Button btnVerFixture = new Button(shlCompetencias, SWT.NONE);
		btnVerFixture.setText("Ver fixture");
		btnVerFixture.setBounds(393, 518, 108, 32);
		
		shlCompetencias.open();
		shlCompetencias.layout();
		while (!shlCompetencias.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 */
	protected void createContents() {
		shlCompetencias = new Shell(SWT.CLOSE | SWT.TITLE | SWT.MIN);
		shlCompetencias.setSize(800, 600);
		shlCompetencias.setText("Competencias");

	}
}
